package javabean;
import java.util.List;
public class User {
    private String userName;
    private String sex;
    private String userPwd;
    private String itemid;
    public User(String userName,String sex, String userPwd,String itemid) {
        this.userName = userName;
        this.userPwd = userPwd;
        this.sex = sex;
        this.itemid = itemid;
    }
    public User() {}//无参构造方法
    //判定两个对象中的属性userName和userPwd是否相同，当相同时，返回1
    public int pdUser(User u) {
        int f = 0;
        if (u.userName.equals(this.userName)) {
            f = 1;
        }
        return f;
    }
    //判定一个对象与一个集合对象中是否有相同的属性userName和userPwd
    public int pdListUser(List<User> u) {
        int f = 0;
        for (int i = 0; i < u.size(); ++i) {
            User u2 = u.get(i);
            if (this.pdUser(u2) == 1) {
                f = 1;
                break;
            }
        }
        return f;
    }
    //以下省略了各属性的setter/getter方法
    public String getUserName(){
             return userName;
    }
    public String getUserPwd(){
        return userPwd;
    }
    public String getUserSex(){ return sex; }
    public String getItemid(){return itemid;}
}
